<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>合约交友 - 筛选列表</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #3b82f6;
            --primary-light: #93c5fd;
            --primary-dark: #1d4ed8;
            --secondary: #ec4899;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --light-bg: #f3f4f6;
            --card-bg: #ffffff;
            --text-primary: #111827;
            --text-secondary: #6b7280;
            --border-color: #e5e7eb;
            --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
            --transition: all 0.2s ease;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--light-bg);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 65px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--card-bg);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            border-bottom: 1px solid var(--border-color);
            z-index: 1000;
        }
        
        .nav-title {
            font-size: 1.1rem;
            font-weight: 600;
        }
        
        .nav-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--transition);
        }
        
        .nav-btn:hover {
            background-color: var(--light-bg);
            color: var(--primary);
        }
        
        /* 搜索栏 */
        .search-bar {
            padding: 12px 16px;
            background-color: var(--card-bg);
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            top: 56px;
            z-index: 900;
        }
        
        .search-container {
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 16px 10px 40px;
            border-radius: 8px;
            border: 1px solid var(--border-color);
            background-color: var(--light-bg);
            font-size: 0.9rem;
        }
        
        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }
        
        /* 筛选标签栏 */
        .filter-tags {
            padding: 8px 16px;
            background-color: var(--card-bg);
            border-bottom: 1px solid var(--border-color);
            overflow-x: auto;
            white-space: nowrap;
            position: sticky;
            top: 113px;
            z-index: 890;
        }
        
        .filter-tag {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            background-color: var(--light-bg);
            border-radius: 20px;
            font-size: 0.85rem;
            color: var(--text-secondary);
            margin-right: 8px;
            cursor: pointer;
            transition: var(--transition);
        }
        
        .filter-tag.active {
            background-color: var(--primary);
            color: white;
        }
        
        .filter-tag .remove-tag {
            display: none;
        }
        
        .filter-tag.selected .remove-tag {
            display: inline;
        }
        
        /* 筛选面板切换器 */
        .filter-tabs {
            display: flex;
            background-color: var(--card-bg);
            border-bottom: 1px solid var(--border-color);
        }
        
        .filter-tab {
            flex: 1;
            padding: 12px 0;
            text-align: center;
            font-size: 0.9rem;
            font-weight: 500;
            color: var(--text-secondary);
            position: relative;
            cursor: pointer;
        }
        
        .filter-tab.active {
            color: var(--primary);
        }
        
        .filter-tab.active::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 0;
            right: 0;
            height: 3px;
            background-color: var(--primary);
        }
        
        /* 筛选内容面板 */
        .filter-panels {
            background-color: var(--card-bg);
            padding: 16px;
            border-bottom: 1px solid var(--border-color);
        }
        
        .filter-panel {
            display: none;
        }
        
        .filter-panel.active {
            display: block;
        }
        
        /* 筛选选项样式 */
        .filter-section {
            margin-bottom: 20px;
        }
        
        .section-title {
            font-weight: 600;
            margin-bottom: 12px;
            font-size: 0.95rem;
            display: flex;
            justify-content: space-between;
        }
        
        .clear-filter {
            color: var(--primary);
            font-size: 0.8rem;
            font-weight: normal;
            cursor: pointer;
        }
        
        .option-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
        }
        
        .option-item {
            padding: 8px 0;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            text-align: center;
            font-size: 0.85rem;
            color: var(--text-secondary);
            cursor: pointer;
            transition: var(--transition);
        }
        
        .option-item.selected {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        /* 滑块筛选样式 */
        .range-slider {
            width: 100%;
            margin: 16px 0;
        }
        
        .range-info {
            display: flex;
            justify-content: space-between;
            font-size: 0.8rem;
            color: var(--text-secondary);
        }
        
        .range-value {
            text-align: center;
            font-weight: 500;
            color: var(--primary);
            margin: 8px 0;
        }
        
        /* 日期筛选样式 */
        .date-range {
            display: flex;
            gap: 10px;
            margin-bottom: 12px;
        }
        
        .date-input {
            flex: 1;
            padding: 8px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            font-size: 0.85rem;
            color: var(--text-secondary);
        }
        
        /* 应用筛选按钮 */
        .filter-actions {
            display: flex;
            gap: 12px;
            padding: 12px 16px;
            background-color: var(--card-bg);
            border-bottom: 1px solid var(--border-color);
            position: sticky;
            bottom: 65px;
            z-index: 880;
        }
        
        .reset-btn {
            flex: 1;
            padding: 10px 0;
            background-color: var(--light-bg);
            color: var(--text-secondary);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            font-weight: 500;
            font-size: 0.9rem;
        }
        
        .apply-btn {
            flex: 1;
            padding: 10px 0;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-weight: 500;
            font-size: 0.9rem;
        }
        
        /* 列表视图切换 */
        .view-controls {
            padding: 10px 16px;
            background-color: var(--card-bg);
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--border-color);
        }
        
        .view-label {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }
        
        .view-buttons {
            display: flex;
            gap: 8px;
        }
        
        .view-btn {
            width: 34px;
            height: 34px;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: var(--light-bg);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-secondary);
        }
        
        .view-btn.active {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        /* 合约列表样式 */
        .contract-list {
            padding: 12px;
        }
        
        /* 卡片视图样式 */
        .contract-card {
            background-color: var(--card-bg);
            border-radius: 10px;
            overflow: hidden;
            margin-bottom: 12px;
            box-shadow: var(--shadow);
        }
        
        .card-header {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border-color);
        }
        
        .contract-title {
            font-weight: 600;
            font-size: 1rem;
            margin-bottom: 6px;
        }
        
        .contract-meta {
            display: flex;
            gap: 12px;
            font-size: 0.8rem;
            color: var(--text-secondary);
        }
        
        .card-body {
            padding: 12px 16px;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 10px;
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .user-details {
            flex: 1;
        }
        
        .user-name {
            font-weight: 500;
            font-size: 0.9rem;
        }
        
        .user-rating {
            font-size: 0.8rem;
            color: var(--warning);
        }
        
        .contract-desc {
            font-size: 0.85rem;
            color: var(--text-secondary);
            line-height: 1.4;
            margin-bottom: 10px;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        .contract-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 10px;
        }
        
        .contract-tag {
            padding: 3px 10px;
            background-color: rgba(59, 130, 246, 0.1);
            color: var(--primary);
            border-radius: 12px;
            font-size: 0.75rem;
        }
        
        .card-footer {
            padding: 10px 16px;
            border-top: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .contract-status {
            font-size: 0.8rem;
            padding: 3px 10px;
            border-radius: 12px;
            font-weight: 500;
        }
        
        .status-active {
            background-color: rgba(16, 185, 129, 0.1);
            color: var(--success);
        }
        
        .action-button {
            padding: 6px 14px;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 0.85rem;
            font-weight: 500;
        }
        
        /* 列表视图样式 */
        .list-view .contract-card {
            display: flex;
            align-items: center;
            padding: 12px 16px;
        }
        
        .list-view .contract-image {
            width: 60px;
            height: 60px;
            border-radius: 8px;
            overflow: hidden;
            flex-shrink: 0;
            margin-right: 12px;
        }
        
        .list-view .contract-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .list-view .no-image {
            width: 60px;
            height: 60px;
            border-radius: 8px;
            background-color: var(--light-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            flex-shrink: 0;
            margin-right: 12px;
        }
        
        .list-view .card-content {
            flex: 1;
        }
        
        .list-view .card-header,
        .list-view .card-body,
        .list-view .card-footer {
            padding: 0;
            border: none;
        }
        
        .list-view .contract-desc,
        .list-view .contract-tags,
        .list-view .user-info {
            display: none;
        }
        
        /* 网格视图样式 */
        .grid-view {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
        }
        
        .grid-view .contract-card {
            display: flex;
            flex-direction: column;
        }
        
        .grid-view .contract-image {
            height: 120px;
            width: 100%;
        }
        
        .grid-view .contract-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .grid-view .no-image {
            height: 120px;
            width: 100%;
            background-color: var(--light-bg);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
        }
        
        .grid-view .contract-desc {
            display: none;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--card-bg);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-color);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.25rem;
            margin-bottom: 4px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 已选筛选条件 */
        .selected-filters {
            padding: 10px 16px;
            background-color: var(--card-bg);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        
        .selected-filter {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 4px 10px;
            background-color: rgba(59, 130, 246, 0.1);
            color: var(--primary);
            border-radius: 16px;
            font-size: 0.8rem;
        }
        
        .remove-filter {
            cursor: pointer;
            font-size: 0.9rem;
        }
        
        /* 提示消息 */
        .toast {
            position: fixed;
            top: 60px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            font-size: 0.9rem;
            z-index: 9999;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast.show {
            opacity: 1;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">合约交友</div>
        <button class="nav-btn" id="menuBtn">
            <i class="fas fa-ellipsis-v"></i>
        </button>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-bar">
        <div class="search-container">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索合约、标签或用户...">
        </div>
    </div>
    
    <!-- 快捷筛选标签 -->
    <div class="filter-tags">
        <div class="filter-tag active">全部合约</div>
        <div class="filter-tag">附近优先</div>
        <div class="filter-tag">最新发布</div>
        <div class="filter-tag">最多报名</div>
        <div class="filter-tag">即将结束</div>
        <div class="filter-tag">线上合约</div>
        <div class="filter-tag">免费参与</div>
    </div>
    
    <!-- 已选筛选条件 -->
    <div class="selected-filters" id="selectedFilters">
        <!-- 动态添加已选筛选条件 -->
        <div class="selected-filter">
            <span>活动类型: 户外活动</span>
            <span class="remove-filter"><i class="fas fa-times"></i></span>
        </div>
        <div class="selected-filter">
            <span>距离: 10公里内</span>
            <span class="remove-filter"><i class="fas fa-times"></i></span>
        </div>
    </div>
    
    <!-- 筛选面板切换器 -->
    <div class="filter-tabs">
        <div class="filter-tab active" data-panel="category">活动类型</div>
        <div class="filter-tab" data-panel="condition">参与条件</div>
        <div class="filter-tab" data-panel="time">时间范围</div>
        <div class="filter-tab" data-panel="distance">距离范围</div>
    </div>
    
    <!-- 筛选内容面板 -->
    <div class="filter-panels">
        <!-- 活动类型筛选面板 -->
        <div class="filter-panel active" id="category-panel">
            <div class="filter-section">
                <div class="section-title">
                    <span>活动分类</span>
                    <span class="clear-filter">清除</span>
                </div>
                <div class="option-grid">
                    <div class="option-item selected">全部类型</div>
                    <div class="option-item selected">户外活动</div>
                    <div class="option-item">文化艺术</div>
                    <div class="option-item">美食聚餐</div>
                    <div class="option-item">运动健身</div>
                    <div class="option-item">学习交流</div>
                    <div class="option-item">休闲娱乐</div>
                    <div class="option-item">线上活动</div>
                    <div class="option-item">其他类型</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="section-title">
                    <span>人群类型</span>
                    <span class="clear-filter">清除</span>
                </div>
                <div class="option-grid">
                    <div class="option-item selected">不限人群</div>
                    <div class="option-item">单身交友</div>
                    <div class="option-item">兴趣小组</div>
                    <div class="option-item">职场交流</div>
                    <div class="option-item">学习伙伴</div>
                    <div class="option-item">运动搭档</div>
                </div>
            </div>
        </div>
        
        <!-- 参与条件筛选面板 -->
        <div class="filter-panel" id="condition-panel">
            <div class="filter-section">
                <div class="section-title">
                    <span>参与人数</span>
                    <span class="clear-filter">清除</span>
                </div>
                <div class="option-grid">
                    <div class="option-item selected">不限</div>
                    <div class="option-item">2-5人</div>
                    <div class="option-item">6-10人</div>
                    <div class="option-item">11-20人</div>
                    <div class="option-item">20人以上</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="section-title">
                    <span>活动费用</span>
                    <span class="clear-filter">清除</span>
                </div>
                <div class="option-grid">
                    <div class="option-item selected">不限</div>
                    <div class="option-item">免费</div>
                    <div class="option-item">50元以下</div>
                    <div class="option-item">51-100元</div>
                    <div class="option-item">101-200元</div>
                    <div class="option-item">200元以上</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="section-title">
                    <span>性别要求</span>
                    <span class="clear-filter">清除</span>
                </div>
                <div class="option-grid">
                    <div class="option-item selected">不限</div>
                    <div class="option-item">仅男性</div>
                    <div class="option-item">仅女性</div>
                    <div class="option-item">男女混合</div>
                </div>
            </div>
        </div>
        
        <!-- 时间范围筛选面板 -->
        <div class="filter-panel" id="time-panel">
            <div class="filter-section">
                <div class="section-title">
                    <span>快捷时间</span>
                    <span class="clear-filter">清除</span>
                </div>
                <div class="option-grid">
                    <div class="option-item selected">全部时间</div>
                    <div class="option-item">今天</div>
                    <div class="option-item">明天</div>
                    <div class="option-item">本周</div>
                    <div class="option-item">本周末</div>
                    <div class="option-item">下周</div>
                    <div class="option-item">本月</div>
                    <div class="option-item">自定义</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="section-title">自定义日期范围</div>
                <div class="date-range">
                    <input type="date" class="date-input" id="startDate">
                    <input type="date" class="date-input" id="endDate">
                </div>
            </div>
            
            <div class="filter-section">
                <div class="section-title">活动时长</div>
                <div class="option-grid">
                    <div class="option-item selected">不限</div>
                    <div class="option-item">1小时内</div>
                    <div class="option-item">1-3小时</div>
                    <div class="option-item">3-6小时</div>
                    <div class="option-item">1天</div>
                    <div class="option-item">1天以上</div>
                </div>
            </div>
        </div>
        
        <!-- 距离范围筛选面板 -->
        <div class="filter-panel" id="distance-panel">
            <div class="filter-section">
                <div class="section-title">距离范围</div>
                <input type="range" min="1" max="50" value="10" class="range-slider" id="distanceSlider">
                <div class="range-value" id="distanceValue">10公里</div>
                <div class="range-info">
                    <span>1公里</span>
                    <span>50公里</span>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="section-title">
                    <span>地点类型</span>
                    <span class="clear-filter">清除</span>
                </div>
                <div class="option-grid">
                    <div class="option-item selected">不限</div>
                    <div class="option-item">市中心</div>
                    <div class="option-item">商业区</div>
                    <div class="option-item">公园景区</div>
                    <div class="option-item">运动场馆</div>
                    <div class="option-item">线上活动</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="section-title">是否需要交通指引</div>
                <div class="option-grid">
                    <div class="option-item selected">不限</div>
                    <div class="option-item">需要</div>
                    <div class="option-item">不需要</div>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 筛选操作按钮 -->
    <div class="filter-actions">
        <button class="reset-btn" id="resetAllBtn">重置全部</button>
        <button class="apply-btn" id="applyFiltersBtn">应用筛选</button>
    </div>
    
    <!-- 视图控制 -->
    <div class="view-controls">
        <div class="view-label">找到 24 个合约</div>
        <div class="view-buttons">
            <button class="view-btn active" data-view="card" title="卡片视图">
                <i class="fas fa-th-large"></i>
            </button>
            <button class="view-btn" data-view="list" title="列表视图">
                <i class="fas fa-list"></i>
            </button>
            <button class="view-btn" data-view="grid" title="网格视图">
                <i class="fas fa-th"></i>
            </button>
        </div>
    </div>
    
    <!-- 合约列表 -->
    <div class="contract-list" id="contractList">
        <!-- 带图片合约 -->
        <div class="contract-card">
            <div class="contract-image">
                <img src="https://picsum.photos/id/29/800/400" alt="户外活动">
            </div>
            <div class="card-header">
                <div class="contract-title">周末登山交友活动</div>
                <div class="contract-meta">
                    <span><i class="far fa-calendar-alt"></i> 周六 08:00</span>
                    <span><i class="fas fa-map-marker-alt"></i> 5.2km</span>
                </div>
            </div>
            <div class="card-body">
                <div class="user-info">
                    <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="user-avatar">
                    <div class="user-details">
                        <div class="user-name">山行者</div>
                        <div class="user-rating"><i class="fas fa-star"></i> 4.9 (32次活动)</div>
                    </div>
                </div>
                <p class="contract-desc">
                    周末一起去郊外登山，难度适中，适合新手体验。全程约3小时，山顶有观景台，适合拍照。提供简单早餐和饮用水。
                </p>
                <div class="contract-tags">
                    <span class="contract-tag">登山</span>
                    <span class="contract-tag">户外</span>
                    <span class="contract-tag">运动</span>
                    <span class="contract-tag">¥88/人</span>
                </div>
            </div>
            <div class="card-footer">
                <span class="contract-status status-active">可报名 (8/12)</span>
                <button class="action-button">申请加入</button>
            </div>
        </div>
        
        <!-- 无图片合约 -->
        <div class="contract-card">
            <div class="no-image">
                <i class="fas fa-book-reader fa-2x"></i>
            </div>
            <div class="card-header">
                <div class="contract-title">线上读书会 - 心理学专题</div>
                <div class="contract-meta">
                    <span><i class="far fa-calendar-alt"></i> 周五 20:00</span>
                    <span><i class="fas fa-video"></i> 线上活动</span>
                </div>
            </div>
            <div class="card-body">
                <div class="user-info">
                    <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="user-avatar">
                    <div class="user-details">
                        <div class="user-name">心灵捕手</div>
                        <div class="user-rating"><i class="fas fa-star"></i> 4.7 (18次活动)</div>
                    </div>
                </div>
                <p class="contract-desc">
                    线上心理学读书会，本周讨论《被讨厌的勇气》，适合对心理学感兴趣的朋友。无需提前阅读，欢迎倾听和分享。
                </p>
                <div class="contract-tags">
                    <span class="contract-tag">读书</span>
                    <span class="contract-tag">心理学</span>
                    <span class="contract-tag">线上</span>
                    <span class="contract-tag">免费</span>
                </div>
            </div>
            <div class="card-footer">
                <span class="contract-status status-active">可报名 (15/30)</span>
                <button class="action-button">申请加入</button>
            </div>
        </div>
        
        <!-- 带图片合约 -->
        <div class="contract-card">
            <div class="contract-image">
                <img src="https://picsum.photos/id/42/800/400" alt="美食活动">
            </div>
            <div class="card-header">
                <div class="contract-title">美食探店 - 新开川菜馆</div>
                <div class="contract-meta">
                    <span><i class="far fa-calendar-alt"></i> 周日 18:30</span>
                    <span><i class="fas fa-map-marker-alt"></i> 3.8km</span>
                </div>
            </div>
            <div class="card-body">
                <div class="user-info">
                    <img src="https://picsum.photos/id/66/100/100" alt="用户头像" class="user-avatar">
                    <div class="user-details">
                        <div class="user-name">吃货达人</div>
                        <div class="user-rating"><i class="fas fa-star"></i> 4.8 (25次活动)</div>
                    </div>
                </div>
                <p class="contract-desc">
                    一起探访新开的川菜馆，品尝正宗四川味道。AA制，人均约100元。喜欢川菜的朋友不要错过，限6人。
                </p>
                <div class="contract-tags">
                    <span class="contract-tag">美食</span>
                    <span class="contract-tag">川菜</span>
                    <span class="contract-tag">聚餐</span>
                    <span class="contract-tag">AA制</span>
                </div>
            </div>
            <div class="card-footer">
                <span class="contract-status status-active">可报名 (4/6)</span>
                <button class="action-button">申请加入</button>
            </div>
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-handshake"></i>
            <span>合约</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-plus-circle"></i>
            <span>发布</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-comment"></i>
            <span>消息</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- 提示消息 -->
    <div class="toast" id="toastMessage"></div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById('backBtn');
        const menuBtn = document.getElementById('menuBtn');
        const filterTabs = document.querySelectorAll('.filter-tab');
        const filterPanels = document.querySelectorAll('.filter-panel');
        const distanceSlider = document.getElementById('distanceSlider');
        const distanceValue = document.getElementById('distanceValue');
        const resetAllBtn = document.getElementById('resetAllBtn');
        const applyFiltersBtn = document.getElementById('applyFiltersBtn');
        const clearFilters = document.querySelectorAll('.clear-filter');
        const filterTags = document.querySelectorAll('.filter-tag');
        const optionItems = document.querySelectorAll('.option-item');
        const viewBtns = document.querySelectorAll('.view-btn');
        const contractList = document.getElementById('contractList');
        const removeFilters = document.querySelectorAll('.remove-filter');
        const toastMessage = document.getElementById('toastMessage');
        
        // 初始化
        function init() {
            setupEventListeners();
            setDefaultDate();
        }
        
        // 设置默认日期
        function setDefaultDate() {
            const today = new Date();
            const nextWeek = new Date(today);
            nextWeek.setDate(today.getDate() + 7);
            
            // 格式化日期为YYYY-MM-DD
            const formatDate = (date) => {
                return date.toISOString().split('T')[0];
            };
            
            document.getElementById('startDate').value = formatDate(today);
            document.getElementById('endDate').value = formatDate(nextWeek);
        }
        
        // 设置事件监听
        function setupEventListeners() {
            // 返回按钮
            backBtn.addEventListener('click', () => {
                history.back();
                showToast('返回上一页');
            });
            
            // 菜单按钮
            menuBtn.addEventListener('click', () => {
                showToast('菜单功能');
            });
            
            // 筛选面板切换
            filterTabs.forEach(tab => {
                tab.addEventListener('click', () => {
                    const panelId = tab.getAttribute('data-panel');
                    
                    filterTabs.forEach(t => t.classList.remove('active'));
                    tab.classList.add('active');
                    
                    filterPanels.forEach(panel => {
                        panel.classList.remove('active');
                    });
                    document.getElementById(`${panelId}-panel`).classList.add('active');
                });
            });
            
            // 距离滑块
            distanceSlider.addEventListener('input', () => {
                const value = distanceSlider.value;
                distanceValue.textContent = `${value}公里`;
            });
            
            // 重置全部筛选
            resetAllBtn.addEventListener('click', () => {
                // 重置选项
                optionItems.forEach(item => {
                    item.classList.remove('selected');
                    if (item.textContent === '全部类型' || 
                        item.textContent === '不限人群' || 
                        item.textContent === '不限' || 
                        item.textContent === '全部时间') {
                        item.classList.add('selected');
                    }
                });
                
                // 重置滑块
                distanceSlider.value = 10;
                distanceValue.textContent = '10公里';
                
                // 重置日期
                setDefaultDate();
                
                // 清空已选筛选
                const selectedFilters = document.getElementById('selectedFilters');
                while (selectedFilters.children.length > 0) {
                    selectedFilters.removeChild(selectedFilters.firstChild);
                }
                
                showToast('已重置全部筛选条件');
            });
            
            // 应用筛选
            applyFiltersBtn.addEventListener('click', () => {
                showToast('筛选条件已应用');
                // 这里可以添加筛选逻辑，更新列表数据
            });
            
            // 清除分类筛选
            clearFilters.forEach(clearBtn => {
                clearBtn.addEventListener('click', () => {
                    const section = clearBtn.closest('.filter-section');
                    const options = section.querySelectorAll('.option-item');
                    
                    options.forEach(item => {
                        item.classList.remove('selected');
                        if (item.textContent.includes('全部') || item.textContent.includes('不限')) {
                            item.classList.add('selected');
                        }
                    });
                });
            });
            
            // 快捷筛选标签
            filterTags.forEach(tag => {
                tag.addEventListener('click', () => {
                    tag.classList.toggle('active');
                    showToast(`${tag.textContent} 筛选已${tag.classList.contains('active') ? '启用' : '取消'}`);
                });
            });
            
            // 选项选择
            optionItems.forEach(item => {
                item.addEventListener('click', () => {
                    // 如果点击的是"全部"或"不限"选项
                    if (item.textContent.includes('全部') || item.textContent.includes('不限')) {
                        const options = item.parentElement.querySelectorAll('.option-item');
                        options.forEach(opt => opt.classList.remove('selected'));
                        item.classList.add('selected');
                    } else {
                        // 取消同组的"全部"或"不限"选项
                        const options = item.parentElement.querySelectorAll('.option-item');
                        options.forEach(opt => {
                            if (opt.textContent.includes('全部') || opt.textContent.includes('不限')) {
                                opt.classList.remove('selected');
                            }
                        });
                        
                        // 切换当前选项状态
                        item.classList.toggle('selected');
                    }
                });
            });
            
            // 视图切换
            viewBtns.forEach(btn => {
                btn.addEventListener('click', () => {
                    const viewType = btn.getAttribute('data-view');
                    
                    viewBtns.forEach(b => b.classList.remove('active'));
                    btn.classList.add('active');
                    
                    // 移除所有视图类
                    contractList.classList.remove('list-view', 'grid-view');
                    
                    // 添加当前视图类
                    if (viewType === 'list') {
                        contractList.classList.add('list-view');
                    } else if (viewType === 'grid') {
                        contractList.classList.add('grid-view');
                    }
                    
                    showToast(`${btn.title}`);
                });
            });
            
            // 移除已选筛选条件
            removeFilters.forEach(removeBtn => {
                removeBtn.addEventListener('click', () => {
                    const filterTag = removeBtn.closest('.selected-filter');
                    filterTag.remove();
                    showToast('已移除筛选条件');
                });
            });
            
            // 申请加入按钮
            document.querySelectorAll('.action-button').forEach(btn => {
                btn.addEventListener('click', function() {
                    const title = this.closest('.contract-card').querySelector('.contract-title').textContent;
                    showToast(`已申请加入 ${title}`);
                    this.textContent = '申请已发送';
                    this.disabled = true;
                    this.style.opacity = '0.8';
                });
            });
        }
        
        // 显示提示消息
        function showToast(message) {
            toastMessage.textContent = message;
            toastMessage.classList.add('show');
            setTimeout(() => {
                toastMessage.classList.remove('show');
            }, 2000);
        }
        
        // 初始化页面
        document.addEventListener('DOMContentLoaded', init);
    </script>
</body>
</html>
